// Modulates LED brightness based on ambient light

const int lightSensorPin = 0;
const int ledPin = 9;

void setup() {
  pinMode(lightSensorPin, INPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  int lightVal = analogRead(lightSensorPin);
  analogWrite(ledPin, map(lightVal, 400, 900, 0, 255));
}
